define(function (require, exports, module) {
	// require('jquery-easyui-zh');
	// require('jquery-easyui');

	var angular = require('angular');
	require('angular-route');
    require('angular-ui-router');
    var asyncLoader = require('angular-async-loader');

	require('ui-datebox');
	require('ui-hide-novalidate');
	require('ui-include');
	require('ui-tabs');
	require('ui-textarea');
	require('ui-window');
	require('easyui-base');

	require('as-chinese-bool');
	require('as-chinese-date');
	require('as-date');
	require('as-empty');
	require('as-length');
	require('easyui-extend');

	require('ui-combo');
	require('ui-combobox');
	require('ui-combotree');
	require('ui-date');
	require('ui-dep');
	require('ui-page');
	require('ui-tree');
	require('ui-user');
	require('easyui-form');
	
	require('easyui');
	// require('easyui');

	require('data-simple');

	require('form-init');
	require('form-search');
	require('form-selected');
	require('form-delete');
	require('form-edit-simple');
	require('form-tree-init');
	require('form-tree-search');
	require('form-tree-edit-simple');

	require('form-child-simple');

	require('dictionary');
	
	require('router-ctrl');
	require('form');

	// require('form');

	require('security');

	require('gis-toolbar');
	require('gis-locator');
	require('gis-config');
	require('gis');
 	// require('gis');

	require('arcgis-draw');
    require('arcgis-geoservice' );
    require('arcgis-graphic' );
    require('arcgis-measure' );
    require('arcgis-printing' );
    require('arcgis-toolbar' );
    require('arcgis-utils' );
    require('arcgis-base' );

    require('arcgis-locator' );

    require('arcgis-map-base' );
    require('arcgis-map-layer' );
    require('arcgis-map-ui' );
    require('arcgis-map');

    require('arcgis-search-attribute' );
    require('arcgis-search-find' );
    require('arcgis-search-identify' );
    require('arcgis-search-result-mutli' );
    require('arcgis-search-result-simple' );
    require('arcgis-search-space' );
    require('arcgis-search-utils' );
    require('arcgis-search' );

    require('arcgis-ui-page' );
    require('arcgis-ui' );
 	require('arcgis');
	// require('arcgis3');

    require('cesium-draw');
    require('cesium-graphic');
    require('cesium-toolbar');
    require('cesium-utils');
    require('cesium-base');

    require('cesium-locator');

	require('cesium-map-base' );
    require('cesium-map-layer' );
    require('cesium-map-ui' );
    require('cesium-map');
    require('cesium');
    // require('cesium1');
    // 
    require('bpm-workflow');
    require('bpm-workflow-sign');
    require('bpm-workflow-back');
    require('bpm-workflow-skip');
    require('bpm-workflow-disposal');
    require('bpm-init');
    require('bpm-selected');
    require('bpm-process');

    var app = angular.module('app', ['ui.router','ui.easyui','form','security','gis','gis.arcgis','gis.cesium',
    'bpm.init','bpm.workflow','bpm.selected','bpm.process','bpm.workflow.sign','bpm.workflow.back','bpm.workflow.skip','bpm.workflow.disposal'])
    // var app = angular.module('app', ['ui.router','ui.easyui','form','security'])
    .factory('$app', function($rootScope, $http) {
		$app = {
			// 打开地图查询面板
			attrOpen : false,
			setAttrOpen : function(isOpen){
				if(isOpen==null){
					this.attrOpen = !this.attrOpen;
				}else{
					this.attrOpen = isOpen;
				}
			},
			// 打开查询结果面板
			searchOpen:true,
			setSearchOpen : function(isOpen){
				if(isOpen==null){
					this.searchOpen = !this.searchOpen;
				}else{
					this.searchOpen = isOpen;
				}
			},

			// mis 下zs-content设置高度
			setConHei:function(){
				var hei = $("#zs-main").height() - $("#zs-mis .zs-map-tool").outerHeight();
				$("#zs-mis .zs-content").height(hei);
			}
		};
		for(f in $app){
			$rootScope[f] = $app[f];
		}
		return $app;
	})
	.controller('appCtrl', ['$rootScope', '$scope', '$app',
		function($rootScope, $scope, $app){

		    $scope.initTestUser=function(){
		    	$rootScope.curUser={};
				$rootScope.curUser["userid"]="725af02a81e04b41a796f694a413e08a";
				//$rootScope.curUser["userid"]="0d0c2952b7b94acd8f36728fdc72ef0c";
				$rootScope.curUser["userName"]="县用户01";
				//$rootScope.curUser["userName"]="县用户02";
				$rootScope.curUser["xian"]="410101";
				$rootScope.curUser["xianName"]="湖南";
		    };

		    $scope.initDemo=function(formName){
				if($rootScope[formName].editRow==null){
					$rootScope[formName].editRow={};
					$rootScope[formName].editRow.id=$rootScope.getGUID();
					$rootScope[formName].editRow[$rootScope.isNew]=true;
				}
			};
		}
	]);

    asyncLoader.configure(app);
    module.exports = app;
});